package com.sc.ppxmanager.Util;

import lombok.Data;

@Data
public class ResponseMsg {
    public static final int SUCCESS=200;
    public static final int ERROR=-200;
    public static  final  int Account_Error=201;
    /**
     * 200--成功
     * 201--失败，
     *
     */
    private Integer code; //响应状态码
    /**
     * msg:添加成功/添加失败/未知错误
     */
    private String msg; //响应提示信息

    private Object data; //响应的具体数据，不同业务不同数据
    public ResponseMsg(){}

    private ResponseMsg(Integer code) {
        this.code = code;
    }
    private ResponseMsg(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    private ResponseMsg(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    private ResponseMsg(Integer code,  Object data) {
        this.code = code;
        this.data = data;
    }

    public static ResponseMsg success(){
        return new ResponseMsg(200);
    }

    public static ResponseMsg success(Integer code){
        return new ResponseMsg(code);
    }

    public static ResponseMsg getInstance(Integer code,String msg){
        return new ResponseMsg(code,msg);
    }

    public static ResponseMsg getInstance(Integer code,String msg, Object data){
        return new ResponseMsg(code,msg, data);
    }

    public static ResponseMsg getInstance(Integer code,Object data){
        return new ResponseMsg(code,data);
    }


}
